<div class="content">
<h2><?php print $this->ingredientCategory->name; ?></h2>
<?php 
$this->addHelperPath('Zend/Dojo/View/Helper/', 'Zend_Dojo_View_Helper');
$this->dojo()->enable()->requireModule('dijit.Tooltip');
$this->headScript()->captureStart();
?>
dojo.addOnLoad(function() {
	priceTooltip = new dijit.Tooltip({
		connectId: ["priceTooltip"],
		label: "Alle Preisangaben sind Durschnittspreise."
	});
	caloriesTooltip = new dijit.Tooltip({
		connectId: ["caloriesTooltip"],
		label: "Kalorienangaben pro 100 g bzw. 100 ml"
	});
});
<?php $this->headScript()->captureEnd(); ?>
<table class="table">
	<thead>
		<tr>
			<th>Zutat</th>
			<th>Alk.- gehalt</th>
			<th><a href="#" class="tip pink" id="caloriesTooltip">Kalorien</a></th>
			<th><a href="#" class="tip pink" id="priceTooltip">Preis</a></th>
			<th>Rezepte</th>
			<th>Produkte</th>
		</tr>
	</thead>
	<tbody>
	<?php foreach ($this->ingredients as $ingredient){ ?>
		<tr>
			<td><a
				href="<?php print $this->url(array('controller'=>'ingredient','action'=>'get','module'=>'website','id'=>$ingredient->getUniqueName())); ?>">
				<?php print $ingredient->name; ?></a></td>
			<td><?php if($ingredient->getAverageAlcoholLevel()) { print $ingredient->getAverageAlcoholLevel().' %'; } else { print '0 %'; } ?></td>
			<td><?php if($ingredient->getAverageCaloriesKcal()) { print round($ingredient->getAverageCaloriesKcal()/10); ?>&nbsp;kcal<?php } else { print 'k.A.'; } ?></td>
			<td><?php 
			if($ingredient->getAveragePricePerLitre() || $ingredient->getAveragePricePerKilogram()) {
				if($ingredient->getAveragePricePerLitre()) {
					print number_format($ingredient->getAveragePricePerLitre(),2,',','.').'&nbsp;€&nbsp;/&nbsp;l ';
				}
				if($ingredient->getAveragePricePerLitre() && $ingredient->getAveragePricePerKilogram()) {
					print ' bzw. ';
				}
				if($ingredient->getAveragePricePerKilogram()) {
					print number_format($ingredient->getAveragePricePerKilogram(),2,',','.').'&nbsp;€&nbsp;/&nbsp;kg';
				}
			} ?></td>
			<td><?php 
			if($ingredient->getRecipes()) {
				$i=0;
				foreach($ingredient->getRecipes() as $recipe){
					$i++;
				}
				?><a
				href="<?php print $this->url(array('controller'=>'ingredient','action'=>'get','module'=>'website','id'=>$ingredient->getUniqueName())); ?>#recipes-list"><?php print $i; ?>
			Stk.</a><?php
			}
			?></td>
			<td><?php 
			$products = Website_Model_Product::productsByIngredientId($ingredient->id);
			if(is_array($products) && count($products)>0) {
				$i=0;
				foreach ($products as $product) {
					$i++;
				}
			?><a href="<?php print $this->url(array('controller'=>'ingredient',
			'action'=>'get','module'=>'website',
			'id'=>$ingredient->getUniqueName())); ?>#products-list"><?php print $i; ?>
			Stk.</a><?php } ?></td>
		</tr>
		<?php } ?>
	</tbody>
</table>
</div> 